package com.changhongit.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.changhongit.dao.ServiceProviderDao;
import com.changhongit.entity.ServiceProvider;
import com.changhongit.returnentity.ReturnServiceProvider;
import com.changhongit.service.ServiceProviderService;
import com.changhongit.util.PageView;

@Transactional
@Service("serviceProviderService")
public class ServiceProviderServiceImpl implements ServiceProviderService {
	@Autowired
	private ServiceProviderDao serviceProviderDao;

	public PageView query(PageView pageView, ServiceProvider serviceProvider) {
		List<ServiceProvider> list = serviceProviderDao.query(pageView,
				serviceProvider);
		pageView.setRecords(list);
		return pageView;
	}

	public void add(ServiceProvider serviceProvider) {
		serviceProviderDao.add(serviceProvider);

	}

	public void delete(String id) {
		serviceProviderDao.delete(id);

	}

	public ServiceProvider getById(String id) {
		return serviceProviderDao.getById(id);
	}

	public void modify(ServiceProvider serviceProvider) {
		serviceProviderDao.modify(serviceProvider);
	}

	public List<ServiceProvider> findAll() {
		System.out.println("dddddddd");
		return serviceProviderDao.findAll();
	}

	public void saveServiceProvider(ServiceProvider serviceProvider) {
		serviceProviderDao.saveServiceProvider(serviceProvider);
	}

	@Override
	public ServiceProvider findOneServiceProvider(String name) {
		return serviceProviderDao.findOneByName(name);
	}

	@Override
	public ServiceProvider findOneServiceProviderByUserName(String userName) {
		return serviceProviderDao.findOneByUserName(userName);
	}

	@Override
	public void updateFlags(ServiceProvider serviceProvider) {
		serviceProviderDao.updateFlags(serviceProvider);
	}

	@Override
	public List<ReturnServiceProvider> findAllServiceProviders(ReturnServiceProvider returnServiceProvider) {
		System.out.println("dddddddddddddddddddddddd");
		return serviceProviderDao.findAllServiceProviders(returnServiceProvider);
	}

	@Override
	public void getCallNum() {
		serviceProviderDao.getCallNum();
	}

}
